package pl.streamsoft.currencyApp.tests;

import java.util.Date;
import java.util.List;

import pl.streamsoft.currencyApp.model.Currency;
import pl.streamsoft.currencyApp.parser.ICurrencyParser;
import pl.streamsoft.currencyApp.services.ICurrencyService;
import pl.streamsoft.currencyApp.stream.IStream;

public class InMemoryCurrencyService implements ICurrencyService{

	private IStream urlStream;
	private ICurrencyParser xmlParser;

	List<Currency> listOfCurrencies = null;

	public InMemoryCurrencyService(IStream stream, ICurrencyParser parser) {
		this.urlStream = stream;
		this.xmlParser = parser;
		this.listOfCurrencies = parser.getListOfCurrenciesFromStringFile(stream.getFile());
	}
	
	@Override
	public List<Currency> getListOfCurrenciesFromDate(Date date, char currencyCodeStart){
		return xmlParser.getListOfCurrenciesFromStringFile(urlStream.getFile());
	}
}
